using System;

namespace Zhao.Models.AppletDto
{
    /// <summary>
    /// 用户参与的活动DTO
    /// </summary>
    public class UserActivityDto
    {
        /// <summary>
        /// 活动ID
        /// </summary>
        public int ActivityId { get; set; }
        
        /// <summary>
        /// 活动标题
        /// </summary>
        public string Title { get; set; }
        
        /// <summary>
        /// 活动日期
        /// </summary>
        public string Date { get; set; }
        
        /// <summary>
        /// 活动时间
        /// </summary>
        public string Time { get; set; }
        
        /// <summary>
        /// 活动状态
        /// </summary>
        public short Status { get; set; }
        
        /// <summary>
        /// 活动状态文本
        /// </summary>
        public string StatusText { get; set; }
        
        /// <summary>
        /// 活动图片
        /// </summary>
        public string Image { get; set; }
        
        /// <summary>
        /// 男性报名人数
        /// </summary>
        public int MaleNumber { get; set; }
        
        /// <summary>
        /// 女性报名人数
        /// </summary>
        public int FemaleNumber { get; set; }
        
        /// <summary>
        /// 总报名人数
        /// </summary>
        public short TotalNumber 
        { 
            get { return (short)(MaleNumber + FemaleNumber); } 
        }

        /// <summary>
        /// 活动价格类型：1-固定价，3-AA制，5-免费
        /// </summary>
        public short PriceType { get; set; }

        /// <summary>
        /// 活动价格类型名称
        /// </summary>
        public string PriceTypeName 
        { 
            get 
            {
                return PriceType switch
                {
                    1 => "固定价",
                    3 => "AA制",
                    5 => "免费",
                    _ => "未知"
                };
            } 
        }

        /// <summary>
        /// 活动原始价格
        /// </summary>
        public decimal Price { get; set; }

        /// <summary>
        /// 押金金额（AA制使用）
        /// </summary>
        public decimal? DepositAmount { get; set; }

        /// <summary>
        /// 是否启用女士优惠
        /// </summary>
        public bool IsLadyDiscountEnabled { get; set; }

        /// <summary>
        /// 优惠类型：1-固定价，3-折扣，5-减价
        /// </summary>
        public short? LadyDiscountType { get; set; }

        /// <summary>
        /// 优惠值
        /// </summary>
        public decimal? LadyDiscountValue { get; set; }

        /// <summary>
        /// 女性优惠说明
        /// </summary>
        public string LadyDiscountDescription 
        { 
            get 
            {
                if (!IsLadyDiscountEnabled || !LadyDiscountType.HasValue || !LadyDiscountValue.HasValue)
                    return "";
                
                return LadyDiscountType switch
                {
                    1 => $"女性固定价 {LadyDiscountValue}元/人",
                    3 => $"女性{LadyDiscountValue * 10}折",
                    5 => $"女性减{LadyDiscountValue}元/人",
                    _ => ""
                };
            } 
        }

        /// <summary>
        /// 实际支付金额
        /// </summary>
        public decimal ActualPaid { get; set; }

        /// <summary>
        /// 已退款金额
        /// </summary>
        public decimal RefundAmount { get; set; }

        /// <summary>
        /// 最终支付金额（实付-退款）
        /// </summary>
        public decimal FinalAmount 
        { 
            get { return ActualPaid - RefundAmount; } 
        }

        /// <summary>
        /// 球馆名称
        /// </summary>
        public string VenueName { get; set; }

        /// <summary>
        /// 球馆地址
        /// </summary>
        public string VenueAddress { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public int OrderId { get; set; }
    }
    
    /// <summary>
    /// 用户活动列表分组
    /// </summary>
    public class UserActivityListDto
    {
        /// <summary>
        /// 进行中的活动
        /// </summary>
        public List<UserActivityDto> OngoingActivities { get; set; } = new List<UserActivityDto>();
        
        /// <summary>
        /// 已完成的活动
        /// </summary>
        public List<UserActivityDto> CompletedActivities { get; set; } = new List<UserActivityDto>();
        
        /// <summary>
        /// 已取消的活动
        /// </summary>
        public List<UserActivityDto> CancelledActivities { get; set; } = new List<UserActivityDto>();
    }
} 